<?php
session_start();
include "../../include/dbFunctions.php";
$sid_a = $_POST['sid'];
$eid=$_POST['eid'];
$date_a=$_POST['myda'];
$starttime_a=$_POST['starttime'];
$endtime_a=$_POST['endtime'];

for ($i=0;$i<count($date_a);$i++) {
//update event table
    $sid = $sid_a[$i];
    $date= $date_a[$i];
    $starttime= $starttime_a[$i];
    $endtime= $endtime_a[$i];
    $query1 = "UPDATE session
            SET session_date = '".$date."',
                session_time = '".$starttime."',
                session_end_time = '".$endtime."'
            WHERE event_id=$eid AND session_id=$sid";
    $result1 = executeQuery($query1);
}
if ($result1!=0) {
    $_SESSION['mes']="The record has been updated successfully";
} else {
    $_SESSION['mes']="Error! Please try again";
}
$link = "../eventView.php?id=$eid";
header("Location: $link ");
/*
print_r($sid)."<br/>";
print_r($eid)."<br/>";
print_r($date)."<br/>";
print_r($time)."<br/>";
*/?>